@extends('layout.wechat_frame')

@section('main')

    <header class="mui-bar mui-bar-nav">
        <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
        <h1 class="mui-title">日常报价-报价清单</h1>
    </header>

    <div class="mui-content">
        <ul class="mui-table-view mui-table-view-striped mui-table-view-condensed">

            <li class="mui-table-view-cell">
                <h4 ><span class="ips-span-first-long">{{ $offer_basket->name }} - 报价需求</span></h4>
                <div>

                    @if ($offer_basket->name == date('Y-m-d'))
                        {!! \App\Services\IPSWechatHelper::showButton(['type'=>'link', 'title'=>'追加需求', 'href'=>route('dailyQuote.dqDetail.append', ['offer_basket' => $offer_basket->id]), 'css'=>'ips-row-btn-big mui-btn-green', 'style'=>'position:absolute; top:16px; right:20px;text-align:center;', 'text'=>'追加']) !!}
                    @endif

                </div>
            </li>

            @foreach ($information as $key=>$item)
                <?php
                $prices = array_keys($item->prices_with_addresses);
                $addresses = array_values($item->prices_with_addresses);
                $rowspan = count($addresses, 1);
                ?>

            <li class="mui-table-view-cell">
                <div class="mui-table">
                    <div class="mui-table-cell mui-col-xs-10">
                        <h5 class="mui-ellipsis">{{ $item->goods->name }}</h5>
                        <h5><span>可供数量：{{ $item->quantity == -1 ? '不限' : strval((float)$item->quantity) }} 吨</span>&nbsp;&nbsp;<span>单价：{{ strval((float)$prices[0]) }} 元/吨</span></h5>
                        <h5><span>送货日期：{{ explode(' ', $item->delivery_start)[0] }} 至 {{ explode(' ', $item->delivery_stop)[0] }}</span>&nbsp;&nbsp;<span>线下议价：{{ $item->bargaining ? '接受' : '不接受' }}</span></h5>
                    </div>
                </div>
                <div>
                    @if ($offer_basket->name == date('Y-m-d'))
                        {!! \App\Services\IPSWechatHelper::showButton(['type'=>'link', 'title'=>'编辑报价', 'href'=>route('dailyQuote.dqDetail.edit', ['offer_information' => $item->id]), 'css'=>'ips-row-btn mui-btn-primary right', 'text'=>'编辑']) !!}
                        {!! \App\Services\IPSWechatHelper::showButton(['confirm'=>'确定要删除此条记录？', 'type'=>'link', 'href'=>route('dailyQuote.dqDetail.delete', ['offer_information' => $item->id]), 'css'=>'ips-row-btn mui-btn-red', 'text'=>'删除']) !!}
                    @else
                        {!! \App\Services\IPSWechatHelper::showButton(['type'=>'link', 'title'=>'编辑报价', 'href'=>route('dailyQuote.dqDetail.view', ['offer_information' => $item->id]), 'css'=>'ips-row-btn mui-btn-blue', 'text'=>'查看']) !!}
                    @endif
                </div>
             </li>

            @endforeach

        </ul>
    </div>


@section('js')
@stop